var an = document.querySelector('#an');
var inp = document.querySelector('.inp');

var abcs;
an.onclick = function() {
	if(inp.value != '') {
		var div = document.createElement('div');
		document.querySelector('.main').appendChild(div);
		var toubu = document.createElement('h3');
		toubu.className = 'td';
		toubu.innerHTML = '今天';
		div.appendChild(toubu);
		var tb = document.createElement('i');
		tb.className = 'fa fa-caret-down';
		tb.id = 'down'
		div.appendChild(tb);
		var ipt = document.createElement('input');
		ipt.value = inp.value;
		inp.value = '';
		div.appendChild(ipt);
		ipt.className = 'ipt';
		var inat = document.createElement('input');
		inat.type = 'checkbox';
		inat.className = 'wc';
		div.appendChild(inat);

		var niu1 = document.createElement('button');
		niu1.className = 'niu1';
		niu1.innerHTML = '修改';
		div.appendChild(niu1);
		console.log(niu1);
		niu1.onclick = function() {
			abcs = prompt('请输入修改后的内容');

			if(abcs.value != inp.value) {
				ipt.value= abcs;
			} else {
				ipt.value == '';
			}
		}

		var niu2 = document.createElement('button');
		niu2.className = 'niu2';
		niu2.innerHTML = '删除';
		div.appendChild(niu2);
		niu2.onclick = function() {
			this.parentElement.parentElement.removeChild(this.parentElement);
		}
	} else {
		alert('请输入内容');
	}
}